#!/usr/bin/env python
#
# Copyright (C) 2007 Juan Manuel Caicedo.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import feedburner


def main(usr, pwd):

    mng = Management(usr, pwd)

    delete_ids = (1234, 99999)
    resync_ids = (7777, )

    print "Listing feeds"
    for feed in mng.find():
        print "Id: %s, Uri=%s, Title: %s" % (feed.id, feed.uri, feed.title)

        if feed.id in resync_ids:
            print "Resync"
            mng.resync(feed)

        if feed.id in delete_ids:
            print "Deleting"
            mng.delete(feed)


if __name__ == '__main__':
    httplib2.debuglevel = 1
    usr = 'juan'
    pwd = 'secret123'
    main(usr, pwd)

